<?php

$data = json_encode($_POST['chords']); //X and Y coordinates && color values
$name = $_POST['name']; //name of the file to create
$mapname = $_POST['mapname'];

mkdir("../images/$mapname");
mkdir("../images/$mapname/maps/");
mkdir("../images/$mapname/maps/coords");
$writefile = fopen("../images/$mapname/maps/coords/" . $name . ".json", "w");
fwrite($writefile, $data);
fclose($writefile);

?>
